package com.example.relativelayoutevent;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;

public class MainActivity extends Activity implements  OnClickListener, View.OnTouchListener {

	private MyButton myButton;
	private MyLayout myLayout;
	private ImageView imvTest;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		myButton = (MyButton)findViewById(R.id.button1);
		myLayout = (MyLayout)findViewById(R.id.layout);

		myLayout.setOnTouchListener(this);
		 myLayout.setClickable(true);
		myLayout.setOnClickListener(this);

		myButton.setOnClickListener(this);
		myButton.setOnTouchListener(this);

	}



	@Override
	public boolean onTouch(View v, MotionEvent event) {

		boolean returenOnTouch = false;
		Log.i("eventTest", "onTouchListener:acton--"+event.getAction()+" ,result="+returenOnTouch+"----view:"+v);
		return returenOnTouch;
	}

	@Override
	public void onClick(View v) {
		Log.i("eventTest", "OnClickListener----view:"+v);
	}

}
